﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.SessionState;

/// <summary>
/// Summary description for HttpModule
/// </summary>
public class HttpModule : IHttpModule, IReadOnlySessionState
{
    public void Dispose()

    { }

    public void Init(HttpApplication application)
    {
        //application.PreRequestHandlerExecute += new EventHandler(application_PreRequestHandlerExecute);
    }

    void application_PreRequestHandlerExecute(object sender, EventArgs e)
    {        
        HttpApplication app = (HttpApplication)sender;
        if (app.Request.Url.ToString().Contains("Login.aspx"))
            return;
        if (HttpContext.Current.Session[FormContract.USER_REF] == null)
            app.Response.Redirect("Login.aspx", true);

    }
}
